<?php
    /* 
    *接口说明: 获取微信用户userid
    *创建者: 	kai
    *时间:	  	20180311
	*/
	require_once 'commom/config.php';

	$json_code = isset($_GET['code']) ? $_GET['code'] : '';
	$url = "https://api.weixin.qq.com/sns/jscode2session?appid=". WECHAT_APPID ."&secret=". WECHAT_APPSECRET ."&js_code=" . $json_code . "&grant_type=authorization_code";
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	$rs = curl_exec($ch);
	curl_close($ch);
	echo json_encode($rs);
?>